{include /common/header}
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
	{php}$num=0;{/php}
	{foreach $configs as $group => $cfg}
		<li role="presentation" class="{if !$num}active{/if}"><a href="#{$group}" aria-controls="{$group}" role="tab" data-toggle="tab">{$group}</a></li>
		{php}$num+=1;{/php}
	{/foreach}
</ul>
<form action="{:\mylib\Route::buildUrl('/admin/config/index')}" method="POST">
	<!-- Tab panes -->
	<div class="tab-content" style="margin-top: 10px;">
		{php}$num=0;{/php}
		{foreach $configs as $group => $cfg}
			<div role="tabpanel" class="tab-pane {if !$num}active{/if}" id="{$group}">
				{foreach $cfg as $v}
				{switch $v['type']}
					{case 'text'}
						<div class="form-group">
							<label class="control-label" for="config_{$v.id}">{$v.title}</label>
							<input type="text" id="config_{$v.id}" class="form-control" name="configs[{$v.id}]" value="{$v.value}">
							<p class="help-block">{$v.tips}</p>
						</div>
					{/case}
					{case 'textarea'}
						<div class="form-group">
							<label class="control-label" for="config_{$v.id}">{$v.title}</label>
							<textarea id="config_{$v.id}" class="form-control" name="configs[{$v.id}]" rows="3">{$v.value}</textarea>
							<p class="help-block">{$v.tips}</p>
						</div>
					{/case}
					{case 'bool'}
						<div class="form-group">
							<label class="control-label" for="config_{$v.id}">{$v.title}</label>
							<select  id="config_{$v.id}" class="form-control" name="configs[{$v.id}]">
								<option value="0" {if $v['value']==0}selected{/if}>否</option>
								<option value="1" {if $v['value']==1}selected{/if}>是</option>
							</select>
							<p class="help-block">{$v.tips}</p>
						</div>
					{/case}
				{/switch}
				{/foreach}
			</div>
			{php}$num+=1;{/php}
		{/foreach}
		<button type="submit" class="btn btn-primary">提交</button>
	</div>
</form>
{include /common/footer}